package com.ac.util;

import org.apache.commons.lang.StringUtils;

import com.ac.common.Constants;

public class StringUtil {
	
	
	
	public static  Integer[] convertStringArrayToIntArray(String[] ss){
		Integer[] rs = new Integer[ss.length];
		for (int i = 0; i < ss.length;i++) {
			rs[i] = Integer.parseInt(ss[i]);
		}
		return rs;
	}
	
	
	
	public static String removeSelectKey(String oldString,String key,String split1){
		
		String[] orderSubUnion = StringUtils.split(oldString,split1);
		
		StringBuffer newString = new StringBuffer();
		for (String string : orderSubUnion) {
			if(!string.equals(key)){
				newString.append(string);
				newString.append(split1);
			}
		}
		return newString.toString();
	}
	
	public static boolean containSelectKey(String str,String key,String splitAssign){
		if(str == null) return false;
		String[] orderSubUnion = StringUtils.split(str, splitAssign);
		
		for (String string : orderSubUnion) {
			if(string.equals(key)){
				return true;
			}
		}
		return false;
	}
}
